import { Opt } from '__com/Opt.js'
import ruleOpt from '@/option/rule.js'
import organApi from '@/biz/organization'
import dt from '@dt/dt'

export class syncOpt extends Opt {
  constructor(info) {
    super(info)
  }

  create(vm) {
    return [
      {
        title: '好房通组织',
        key: 'orgId',
        treeSelect: {
          data: []
        },
        load: (o) => {
          organApi.getOrganization().then((res) => {
            res.map((item) => {
              if (item.level == 1) {
                item.disabled = true
              }
            })
            o.treeSelect.data = res
          })
        },
        rules: [ruleOpt.required('请选择组织', 'number')]
      }
    ]
  }
}
